package dissertation.examples.ejb21.entity;

import javax.ejb.*;

public abstract class ProductBean implements EntityBean {
    public ProductBean() {
    }

    public void setEntityContext(EntityContext entityContext) throws EJBException {
        System.out.println("setEntityContext()");
    }

    public void unsetEntityContext() throws EJBException {
        System.out.println("unsetEntityContext()");
    }

    public void ejbRemove() throws RemoveException, EJBException {
        System.out.println("ejbRemove()");
    }

    public void ejbActivate() throws EJBException {
        System.out.println("ejbActivate()");
    }

    public void ejbPassivate() throws EJBException {
        System.out.println("ejbPassivate()");
    }

    public void ejbLoad() throws EJBException {
        System.out.println("ejbLoad()");
    }

    public void ejbStore() throws EJBException {
        System.out.println("ejbStore()");
    }

    public abstract String getProductId();

    public abstract void setProductId(String productId);

    public abstract String getName();

    public abstract void setName(String name);

    public abstract Double getPrice();

    public abstract void setPrice(Double price);

    @Override
    public ProductPK ejbCreate(String productId, String name, double price) throws CreateException {
        System.out.println("ejbCreate(" + productId + ", " + name + ", " + price + ")");
        setProductId(productId);
        setName(name);
        setPrice(price);
        return new ProductPK(productId);
    }

    @Override
    public void ejbPostCreate(String productId, String name, double price) throws CreateException {
        System.out.println("ejbPostCreate()");
    }
}
